home *** CD-ROM | disk | FTP | other *** search
/ Point Programming 1 / PPROG1.ISO / pascal / swag / printing.swg / 0016_Printer Ready Function.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1993-07-16  |  1.4 KB  |  42 lines

  1. ===========================================================================
  2.  BBS: The Beta Connection
  3. Date: 07-06-93 (15:28)             Number: 1525
  4. From: CHRIS PRIEDE                 Refer#: 1378
  5.   To: PETER KIRKWOOD                Recvd: NO  
  6. Subj: Printer Ready?                 Conf: (232) T_Pascal_R
  7. ---------------------------------------------------------------------------
  8. PK>    Any suggestions as to how I can check if a printer is online
  9. PK>and/or ready would be appreciated.
  10.  
  11.     Interrupt 17h service 02h returns printer status flags. We are
  12. interested in three:
  13.  
  14.     bit 7 = 1   Ready
  15.     bit 5 = 1   Out of paper
  16.     bit 3 = 1   I/O error
  17.  
  18.  
  19.     Bit 7 should be 1 and bits 5, 3 -- 0. You can use the following
  20. BASM routine to check it:
  21.  
  22. const
  23.   pnLPT1    = 0;
  24.   pnLPT2    = 1;
  25.   pnLPT3    = 2;
  26.  
  27. function PrinterReady(PN: word): boolean; assembler;
  28. asm
  29.     mov     dx, PN              {printer number goes in DX}
  30.     mov     ah, 02h
  31.     int     17h                 {int. 17h service 02h}
  32.     xor     al, al              {assume false}
  33.     and     ah, 10101000b       {clear all other bits}
  34.     cmp     ah, 10000000b       {ready & not out of paper or error?}
  35.     jne     @Done               {no -- leave result false}
  36.     inc     ax                  {yes -- change to true}
  37. @Done:
  38. end;
  39. ---
  40.  * D.W.'s TOOLBOX, Atlanta GA, 404-471-6636
  41.  * PostLink(tm) v1.06  DWTOOLBOX (#1035) : RelayNet(tm)
  42.